<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>数据管理</el-breadcrumb-item>
        <el-breadcrumb-item>数据列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <div id="main"></div>
    </el-card>
  </div>
</template>

<script>
import echarts from 'echarts'
export default {
  data () {
    return {
    }
  },

  created () {

  },
  async mounted () {
    var myChart = echarts.init(document.getElementById('main'))
    const { data: res } = await this.$axios.get('reports/type/1')
    console.log(res)
    // 去除x轴两侧留白
    res.data.xAxis[0].boundaryGap = false
    // 添加鼠标经过的效果
    res.data.tooltip = {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label: {
          backgroundColor: '#6a7985'
        }
      }
    }
    // 绘制图表
    myChart.setOption(res.data)
  },
  methods: {

  }
}
</script>

<style scoped lang='less'>
#main {
  width: 800px;
  height: 500px;
}
</style>
